package org.onion.pattern.kit.springtool.retry;

import lombok.extern.slf4j.Slf4j;
import org.aopalliance.intercept.MethodInterceptor;
import org.aopalliance.intercept.MethodInvocation;
import org.onion.pattern.kit.springtool.exception.RetryableException;

@Slf4j
public class VersionRetryMethodInterceptor implements MethodInterceptor {
    @Override
    public Object invoke(MethodInvocation invocation) throws Throwable {
        try {
            return invocation.proceed();
        } catch (RetryableException e) {
            log.warn("冲突重试 {}", invocation.getMethod());
            throw e;
        }
    }

}
